const UserApi = require("../api/user.js");
const commonUtil = require("../utils/common.js");

Component({
  properties: {
    _globalData: {type: Object, value: {}},
    modalContent: {type: Object, value: {}},
  },
  options: {
    addGlobalClass: true
  },
  data: {},
  methods: {
    toLogin(){
      wx.removeStorageSync('userInfo')
      wx.removeStorageSync('token')
      wx.redirectTo({
        url: '/packageA/pages/login/index?redirect_uri=/packageA/pages/quotation/index&redirect_uri_type=link',
      })
    },
    toApply(){
      UserApi.applyMemberServiceOrder().then(res=>{
        if (res.retCode == '000000' && res.errCode == '000000') {
          wx.showToast({
            icon: 'success',
            title: "申请数据试用成功",
          })
          commonUtil.getUserServiceState();
        } else {
          wx.showToast({
            icon: 'error',
            title: res.errMsg,
          })
        }
      })
    },
  }
})